package com.leyou.common.advice;

import com.leyou.common.exception.LyException;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * @author mySun
 * @create 2021-07-12 17:41
 */
@ControllerAdvice
public class ControllerExceptionAdvice {

    @ExceptionHandler
    public ResponseEntity<String> handleLyException(LyException ex){
        return ResponseEntity.status(ex.getStatus()).body(ex.getMessage());
    }
}
